

  
qui {
	
use wsample1, clear


set more off


	

#delimit ;
global labels1 
	"
	r_decline_nloss "Pessimist"  
	r_loss "Memory loss" 
	r_loss_a "Aware" 
	r_loss_u "Unaware" 
	lh_atotb "Wealth$_{t-1}$"
	h_atotbc "$\Delta$ Wealth$_{t}$"
	ltot_r "Recall$_{t-1}$"
	age "Age"
	HS "High school"
	college "College degree"
	female "Female"
	black "Black"
	other "Other races"
	lwork "Working$_{t-1}$"
	lalone "Single $_{t-1}$"
	h_child "Children"
	p_death_new "Partner death$_t$"
	lqrec "Memory score$_t-1$ (quartiles)"
	lgood "Very good health$_{t-1}$"
	ladl " ADL limitations$_{t-1}$ "
	mean "Mean Wealth"
	ymean "Mean Change"
	exp_diff "predicted $\Delta$ Wealth"
	"
	;	
#delimit cr




  
global X0 "c.age##c.age  i.t "
global X "$X0 i.mstat  hs college i.lbrf ragender i.raracem i.cendiv ad_impw_atotb"

global treat1 " r_loss_a r_loss_u   r_decline_nloss"
global treat2 " r_loss  r_loss_u   r_decline_nloss"


cap log close

log using main_tables, t replace



 
*******************************************************************
******Table 1 Descriptive by sample *******************************
*******************************************************************
  use wsample1, clear
  
  preserve
	qui  reg h_atotbc  r_loss  $X    [pw=wtresp] 
	gen sample1=1 if e(sample)==1
	qui  reg h_atotbc  r_loss  $X if  lfinr==1  [pw=wtresp] 
	gen sample2=1 if e(sample)==1

	qui  reg h_atotbc  r_loss  $X if  r_loss==1 [pw=wtresp] 
	gen sample3=1 if e(sample)==1

	qui  reg h_atotbc  r_loss  $X if  lfinr==1 & r_loss==1 [pw=wtresp] 
	gen sample4=1 if e(sample)==1

  
  forvalue n=1/4 {
 qui estpost summarize   h_atotbc lh_atotb r_loss_a r_loss_u r_decline_nloss ltot_r age female single hs college lwork black other if sample`n'==1
 est store S`n'
   }
   
   noi di "************Table 1************"

  noi  estout S2 S4, cells("count (fmt(%9.0f)) mean (fmt(%9.3f)) sd (fmt(%9.3f))")   style(tex)  varlabel($labels1)
  restore

*******************************************************************
****** Table 2 Self-rated health vs. assessed memory **************
*******************************************************************
use wsample1, clear

keep if lfinr==1

noi di "************Table 2************"
noi tab pstmem r_loss, cell
noi tab pstmem loss_t, cell

*******************************************************************
****** Table 3 Determinants of cognitive loss and awareness********
*******************************************************************

use wsample1, clear

   qui xtile q4bw_full= lh_atotb , nq(4) 

 **define the two samples without missings for covariates
qui probit r_loss_u age  lwork lalone female educy  black  other  lqrec  ladlap  lgood p_death_new  q4bw_full  serious_hc    [pw=wtresp]   , r cluster (hhid)
gen SP0=e(sample)

qui probit r_loss_u age  lwork lalone female educy  black  other  lqrec ladlap lgood  p_death_new q4bw_full serious_hc   [pw=wtresp]  if r_loss==1  , r cluster (hhid)
gen SP1=e(sample)



  
local base "c.age##c.age    lalone female  h_child    p_death_new  educy lwork  i.q4bw_full  lqrec black other  i.t"
local health "lgood ladlap serious_hc"



forvalue n=0/1 {
	
if `n'==0 {
	local y r_loss
}
else {
	local y r_loss_u
}
	
probit `y'  `base' [pw=wtresp]  if  SP`n'==1  , r cluster (hhid)
margins, dydx(*) post
 	sum `y'  if e(sample)
	estadd r(mean)
 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
		drop id	
est store P`n'1

probit `y'   `base' `health'     [pw=wtresp] if  SP`n'==1  , r cluster (hhid)
margins, dydx(*) post
sum `y'  if e(sample)
	estadd r(mean)
	egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
		drop id	
est store P`n'2

probit `y'    `base' `health'  num0   [pw=wtresp] if SP`n'==1   , r cluster (hhid)
margins, dydx(*) post
sum `y'  if e(sample)
	estadd r(mean)
egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
		drop id	
est store P`n'3

}


noi di "************Table 3************"
noi estout	 	    P01 P02 P03  P11 P12  P13 , 		///
	style(tex)  stard cells (  b(star fmt(%9.3f)) se (par))  stats(N max mean,labels("Obs" "$ N $" "Mean" ) fmt(%9.5g)) varlabel($labels1)  starlevels(* 0.100 ** 0.05 *** 0.01)  nolz drop (black other 1.q4bw_full  *.t )
	
  
  





******************************************
 **********Table 4************************
******************************************
qui {
use wsample1, clear
   reg h_atotbc  r_loss  $X if  lfinr==1 [pw=wtresp] , r cluster (hhid)
	est store B0
		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id

   reg h_atotbc  r_loss lqrec lh_atotb $X  if  lfinr==1 [pw=wtresp] , r cluster (hhid)
	est store B1
		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id	
	
   reg h_atotbc   r_loss_a r_loss_u  r_decline_nloss lqrec lh_atotb  $X if lfinr==1 [pw=wtresp] , r cluster (hhid)
	est store B2
		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id	
	
   reg h_atotbc r_loss_u lqrec lh_atotb $X if  r_loss==1 & lfinr==1  [pw=wtresp] , r cluster (hhid)
	est store C
		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id	
	
  reg h_atotbc      r_loss_u   lqrec lh_atotb   $X if   r_loss==1  & lfinr==1 [pw=wtresp] , r cluster (hhid)
  	est store FRY
		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id	
	
  reg h_atotbc      r_loss_u   lqrec lh_atotb  $X  if  lfinr==0  & r_loss==1 [pw=wtresp] , r cluster (hhid)
	est store FRN
		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id	


noi di "************Table 4************"

  noi estout	 	  B1 B2 FRY FRN , 		///
	style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean $\Delta$ W" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss r_decline_nloss r_loss_a r_loss_u) varl( $labels ) nolz	
   
}

   reg h_atotbc  r_loss lqrec lh_atotb $X  if  lfinr==1 [pw=wtresp] , r cluster (hhid)
	est store B1
	
      reg h_atotbc  r_decline_nloss r_loss r_loss_u lqrec lh_atotb  $X  if  lfinr==1 [pw=wtresp] , r cluster (hhid)
	est store B2
	
  noi estout	 	   B1 B2 , 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_u) varl( $labels ) nolz	


	
	
******************************************
 ****Table 5 Static DID ******************
******************************************
	
	
use wsample2,clear 



******robustness for Reviewers: exclude Hospitalizations*********
*bysort hhidpn: egen temp=total(hosp)
*gen ev_hosp= temp>0
*drop temp 

*gen hos0=hosp==1 & time==0
*bysort hhidpn: egen temp=total(hos0)
*gen h0= temp>0
*drop temp 

* drop if hosp==1 //  | h_shock==1
********************************************************************
	

		local letter b f
		foreach y of local  letter {

		reg h_atot`y'c    post sample_u  post_u   sample_a   $X time lh_atot`y' lqrec    [pw=wtresp] , r cl(hhid)
			 sum h_atot`y' if e(sample)
		estadd r(mean)
		estadd ysumm,mean
		 egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
		est store P1_`y'
 
		reg h_atot`y'c    post sample_u  post_u      $X time  lh_atot`y' lqrec   if  (sample_a==1|sample_u==1)  [pw=wtresp] , r cl(hhid) 
			 sum h_atot`y' if e(sample)
		estadd r(mean)
		estadd ysumm,mean
		 egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
		est store P1_R_`y'
		}
		
		noi di "************Table 5************"

 		noi estout	   P1_b  P1_R_b  P1_f  P1_R_f , 		///
	style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean \Delta W"))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  keep(  post_u  post sample_u  sample_a) nolz
		

 ******************************************
  ****Table 6 By quartiles of income*******
  *****************************************
	
	use wsample1, clear
	  keep if lfinr==1
 
	  forvalue n=1/4 {

   reg h_atotbc r_decline_nloss r_loss_a r_loss_u $X lqrec lh_atotb if q4bw==`n'    [pw=wtresp] , r cluster (hhid)
	 		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
		 egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
	est store T`n'
		
	reg h_atotbc r_decline_nloss r_loss r_loss_u $X lqrec lh_atotb if  q4bw==`n'     [pw=wtresp] , r cluster (hhid)
	est store T`n'D
	  }
	  
	  noi di "************Table 6************"

	 
		
		noi estout	 	  T1  T2  T3  T4 , 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean $\Delta$ W" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_a r_loss_u) varl( $labels ) nolz	
  	   *test betas
  
			noi estout	 	  T1D  T2D  T3D  T4D  , 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_u) varl( $labels ) nolz	


 
 ****************************************
  ****Table 7 wealth breakdown **********
  ***************************************
  
   
	  foreach y of varlist h_atotb h_atotf h_aira housw h_arles h_absns h_atran{
reg  `y'c   r_loss_a r_loss_u  r_decline $X   lqrec l`y'  [pw=wtresp] , r cluster (hhid)
		 sum `y' if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
	est store `y'
	reg  `y'c r_loss_u  r_loss  r_decline $X  lqrec l`y'    [pw=wtresp] , r cluster (hhid)
		est store `y'_t

	   }
	   
	   
	   noi di "************Table 7************"

  noi estout	 h_atotb h_atotf h_aira housw h_arles h_absns h_atran, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean $\Delta$ W" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_a r_loss_u) varl( $labels ) nolz	

*test betas

	   
  noi estout	 	   h_atotb_t h_atotf_t h_aira_t housw_t h_arles_t h_absns_t h_atran_t, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep( r_loss_u) varl( $labels ) nolz	

  
*******************************************************
***Table 8 By initial financial wealth ownership*******
*******************************************************
	

	*T6 FW by initial financial wealth ownership and initial finnancial wealth quartile
	   noi disp "FW by initial wealth"

    reg h_atotfc  r_decline_nloss r_loss_a r_loss_u lqrec lh_atotf  $X  if  lh_atotf<=0 [pw=wtresp] , r cluster (hhid)
		 sum h_atotf if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
	est store FW0
	
	reg h_atotfc  r_decline_nloss r_loss_a r_loss_u lqrec lh_atotf  $X  if  lh_atotf>0 [pw=wtresp] , r cluster (hhid)
		 sum h_atotf if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
	est store FW1
	
		forvalue n=3/4 {

	reg h_atotfc  r_decline_nloss r_loss_a r_loss_u lqrec lh_atotf  $X  if  lh_atotf>0 & q4fw==`n'  [pw=wtresp] , r cluster (hhid)
		 sum h_atotf if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
	est store FW1`n'
		}
	
	
noi di "************Table 8************"

	
	noi estout	 	FW0 FW1 FW13 FW14, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean $\Delta$ W" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_a r_loss_u) varl( $labels ) nolz	
				
	
	*test betas
	
	 reg h_atotfc  r_decline_nloss r_loss r_loss_u lqrec lh_atotf  $X  if  lh_atotf<=0 [pw=wtresp] , r cluster (hhid)
	est store FW0
	
	reg h_atotfc  r_decline_nloss r_loss r_loss_u lqrec lh_atotf  $X  if  lh_atotf>0 [pw=wtresp] , r cluster (hhid)
	est store FW1
	
	forvalue n=3/4 {

	
	reg h_atotfc  r_decline_nloss r_loss r_loss_u lqrec lh_atotf  $X  if  lh_atotf>0 & q4fw==`n' [pw=wtresp] , r cluster (hhid)
	est store FW1`n'
	}
	
	noi estout	 	FW0 FW1 FW13 FW14, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_u) varl( $labels ) nolz	
				
	
	
 ***********************************************
  ****Table 9  Financial wealth breakdown ******
  **********************************************
  
	

	   foreach y of varlist h_astck h_abond h_adebt h_aothr h_acd h_achck {
reg  `y'c r_loss_a r_loss_u  r_decline $X   lqrec l`y' if  lh_atotf>0  [pw=wtresp] , r cluster (hhid)
		 sum `y' if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
		sum id
		estadd r(max)
		drop id
	est store `y'
reg  `y'c r_loss_u  r_loss  r_decline $X  lqrec l`y' if  lh_atotf>0  [pw=wtresp] , r cluster (hhid)
	est store `y'_t
	   }
	   
	   noi di "************Table 9************"

  noi estout	 h_astck  h_acd h_achck  h_abond h_aothr h_adebt, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean $\Delta$ W" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_a r_loss_u) varl( $labels ) nolz	

*test betas

  noi estout	 h_astck_t  h_achck_t h_acd_t h_abond_t h_aothr_t h_adebt_t, 		///
	style(tex) stard cells(b(star fmt(%9.3f)) se(par))   starlevels(* 0.100 ** 0.05 *** 0.01)  ///		 
				keep( r_loss_u ) varl( $labels ) nolz	

  

   *****************************************
  ****Table 10 by stock market activity*****
  ******************************************
  


reg h_atotfc r_decline r_loss_a r_loss_u r_decline $X lqrec  lh_atotb if   financial_activity==1   [pw=wtresp] , r cluster (hhid)
  	 sum h_atotf if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
				drop id
		est store F1

		reg h_atotfc r_decline r_loss_a r_loss_u r_decline $X lqrec  lh_atotb if  financial_activity==0   [pw=wtresp] , r cluster (hhid)
		  	 sum h_atotf if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
				drop id
		est store F0
		
   reg h_atotfc r_decline  r_loss_a r_loss_u r_decline $X lqrec  lh_atotb if  financial_activity==.   [pw=wtresp] , r cluster (hhid)
     	 sum h_atotf if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
				drop id
		est store FA
		
		
		noi di "************Table 10************"

		noi estout	 	  F1 F0 FA, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean $\Delta$ W" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_a r_loss_u) varl( $labels ) nolz	
	
   
	
	reg h_atotfc r_decline r_loss_u r_loss r_decline $X lqrec  lh_atotb if   financial_activity==1   [pw=wtresp] , r cluster (hhid)
		est store F1

		reg h_atotfc r_decline r_loss_u r_loss r_decline $X lqrec  lh_atotb if   financial_activity==0   [pw=wtresp] , r cluster (hhid)
		est store F0
		
   reg h_atotfc r_decline r_loss_u r_loss r_decline $X lqrec  lh_atotb if   financial_activity==.   [pw=wtresp] , r cluster (hhid)
		est store FA
		
		noi estout	 	  F1 F0 FA, 		///
	style(tex) stard cells(b(star fmt(%9.3f)) se(par))  starlevels(* 0.100 ** 0.05 *** 0.01)  ///		 
				keep(  r_loss_u   ) varl( $labels ) nolz	



  
 ***************************************************
  ****Table 11 Actual and predicted wealth changes**
  **************************************************
		
   probit r_loss exp_diff lqrec lh_atotb $X  if  lfinr==1 [pw=wtresp] , r cluster (hhid)
   margins, dydx(*) post
	est store P0
		
	
probit r_loss_u exp_diff lqrec  lh_atotb $X  if  lfinr==1 & r_loss==1 [pw=wtresp] , r cluster (hhid)
margins, dydx(*) post
	est store P1
	
	

	reg h_atotbc  r_loss_a r_loss_u r_decline_nloss  exp_diff lqrec lh_atotb  $X  if  lfinr==1  [pw=wtresp] , r cluster (hhid) 
	est store C
		 sum h_atotbc if e(sample)
		estadd r(mean)
		estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id	
	
	reg h_atotbc   exp_diff lqrec lh_atotb  $X  if  lfinr==1 & e(sample)==1   [pw=wtresp] , r cluster (hhid) 
	est store A
		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id	
    reg h_atotbc  r_loss_a r_loss_u r_decline_nloss  lqrec lh_atotb $X  if  lfinr==1 & e(sample)==1 [pw=wtresp] , r cluster (hhid) 
	est store B
		 sum h_atotb if e(sample)
		estadd r(mean)
		estadd ysumm,mean
	 egen id=group(hhidpn) if e(sample)
	 sum id
	estadd r(max)
	drop id	
	
	noi di "************Table 11************"

	noi estout	 	P0 P1 A B C, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean $\Delta$ W" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(exp_diff r_loss_a r_loss_u) varl( $labels ) nolz	
	
	

	reg h_atotbc  r_loss_u r_loss r_decline_nloss  exp_diff lqrec lh_atotb  $X  if lfinr==1  [pw=wtresp] , r cluster (hhid) 
	est store C
	

	
    reg h_atotbc  r_loss_u r_loss r_decline_nloss  lqrec lh_atotb $X  if  lfinr==1 & e(sample)==1 [pw=wtresp] , r cluster (hhid) 
	est store B
	
	noi estout	 	P0 P1 A B C, 		///
	style(tex) stard cells(b(star fmt(%9.3f)) se(par))   starlevels(* 0.100 ** 0.05 *** 0.01)  ///		 
				keep(   r_loss_u) varl( $labels ) nolz				
				
				


*******************************************
 ****Table 12 OOP and life expectancy******
 ******************************************

   qui   reg oopmdc r_loss  $X  lqrec lh_atotb if  oopmdf == 0 [pw=wtresp] , r cluster (hhid)
  sum oopmd
  estadd r(mean)
  		estadd ysumm,mean
   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
  eststo OOP_0
   
	qui reg oopmdc r_loss_a r_loss_u  decline_nloss $X  lqrec lh_atotb if  oopmdf == 0 [pw=wtresp] , r cluster (hhid)
	  sum oopmd
	estadd r(mean)
	estadd ysumm,mean
   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
		drop id
  eststo OOP_1
 
 
  qui reg liv10c r_loss decline_nloss $X  lqrec lh_atotb    [pw=wtresp] , r cluster (hhid)
  sum liv10
  estadd r(mean)
  	estadd ysumm,mean
   egen id=group(hhidpn) if e(sample)
	sum id
	estadd r(max)
				drop id
  est store LE_0
  qui reg liv10c  r_loss_a r_loss_u  $X  lqrec lh_atotb      [pw=wtresp] , r cluster (hhid)
  sum liv10
  estadd r(mean)
estadd ysumm,mean
  egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
				drop id
  est store LE_1
 


	   noi di "************Table 12************"

 noi estout	 	   LE_0   LE_1 OOP_0 OOP_1, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean" "Mean" ) fmt(%9.5g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss r_loss_a r_loss_u) varl( $labels ) nolz	

		
		
   qui   reg oopmdc r_loss  $X  lqrec lh_atotb if  oopmdf == 0 [pw=wtresp] , r cluster (hhid)
  eststo OOP_0
   
	qui reg oopmdc r_loss_u r_loss decline_nloss $X  lqrec lh_atotb if  oopmdf == 0 [pw=wtresp] , r cluster (hhid)
	  eststo OOP_1
 
  qui reg liv10c r_loss decline_nloss $X  lqrec lh_atotb    [pw=wtresp] , r cluster (hhid)
  est store LE_0
  
  qui reg liv10c r_loss_u r_loss   $X  lqrec lh_atotb      [pw=wtresp] , r cluster (hhid)
  est store LE_1
 

 noi estout	 	   LE_0   LE_1 OOP_0 OOP_1, 		///
	style(tex) stard cells(b(star fmt(%9.3f)) se(par))   starlevels(* 0.100 ** 0.05 *** 0.01)  ///		 
				keep(  r_loss_u  ) varl( $labels ) nolz	


 **************************************************
 ***** T13 risky assets and shares*****************
 **************************************************



	reg risky_ac r_loss_a r_loss_u   $X lqrec lh_atotf     [pw=wtresp] , r cluster (hhid)
		 sum lrisky_a if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
				drop id
		est store DA

	reg risky_sc r_loss_a r_loss_u  $X lqrec lh_atotf  if  risky_a>0    [pw=wtresp] , r cluster (hhid)
		 sum lrisky_s if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
				drop id
		est store DS
		
	reg risky_ac r_loss_a r_loss_u  $X lqrec lh_atotf  if   q4bw>2    [pw=wtresp] , r cluster (hhid)
		 sum risky_a if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
				drop id
		est store DAC

	reg risky_sc r_loss_a r_loss_u  $X lqrec lh_atotf if  q4bw>2 &risky_a>0    [pw=wtresp] , r cluster (hhid)
		 sum risky_s if e(sample)
	estadd r(mean)
	estadd ysumm,mean
	   egen id=group(hhidpn) if e(sample)
		 sum id
		estadd r(max)
				drop id
		est store DSC


		noi di "************Table 13************"

					
  noi estout	 	 DA DAC DS  DSC, 		///
style(tex) stard cells(b(star fmt(%9.3f)) se(par)) stats(N max mean ymean ,labels("Obs." "N" "Mean W" "Mean $\Delta$ W" ) fmt(%9.3g))  ///
	starlevels(* 0.100 ** 0.05 *** 0.01)  	 keep(r_loss_a r_loss_u) varl( $labels ) nolz	
				
				
	
	
		reg risky_ac r_loss_u r_loss   $X lqrec lh_atotf    [pw=wtresp] , r cluster (hhid)

		est store DA

	reg risky_sc r_loss_u r_loss  $X lqrec lh_atotf  if  risky_a>0   [pw=wtresp] , r cluster (hhid)

		est store DS
		
	reg risky_ac r_loss_u r_loss  $X lqrec lh_atotf  if   q4bw>2    [pw=wtresp] , r cluster (hhid)

		est store DAC

	reg risky_sc r_loss_u r_loss  $X lqrec lh_atotf  if q4bw>2  &risky_a>0   [pw=wtresp] , r cluster (hhid)

		est store DSC


					
  noi estout	 	 DA DAC DS  DSC, 		///
	style(tex) stard cells(b(star fmt(%9.3f)) se(par))  starlevels(* 0.100 ** 0.05 *** 0.01)  ///		 
				keep(  r_loss_u   ) varl( $labels ) nolz	


  			  cap log close


		
  
  }
  
 
